<!--  -->
<template>
  <div class="balance">
    <header>
      <!-- <Headerss title="我的账户" /> -->
      <div @click="gohome"><svg-icon iconClass="back" /></div>
      <div>我的账户</div>
      <div></div>
    </header>
    <main>
      <div class="top">
        <div class="one">
          <p class="yuan">总资产(元)</p>
          <p class="price">0.00</p>
        </div>
        <div class="two">
          <div class="recharge" @click="isShow">充值</div>
        </div>
        <div class="three">
          <p class="yuan">累计充值(元)</p>
          <p class="price">0</p>
        </div>
        <div class="four">
          <p class="yuan">累计消费(元)</p>
          <p class="price">0</p>
        </div>
      </div>
      <div class="middle">
        <li @click="toBankCard">
          <van-icon name="credit-pay" />
          <span>银行卡</span>
        </li>
        <li>
          <van-icon name="cash-on-deliver" />
          <span>消费记录</span>
        </li>
        <li>
          <van-icon name="diamond-o" />
          <span>积分中心</span>
        </li>
      </div>
      <div class="lower">
        <img src="../../assets/img/images/one.jpg" alt="" />
        <img src="../../assets/img/images/two.jpg" alt="" />
      </div>
      <div class="zuixia">
        <p><img src="../../assets/img/images/images/sss_03.gif" alt="" /></p>
      </div>
      <div class="zuihou">
        <div class="imgs">
          <img src="../../assets/img/sss_030.gif" alt="" />
        </div>
        <div class="imgss">
          <img src="../../assets/img/sss_040.gif" alt="" />
        </div>
      </div>
      <div class="dialog" v-if="showPopover">
        <p><button @click="toRecharge">充值未绑卡</button></p>
        <p><button @click="topays">充值已绑卡</button></p>
      </div>
    </main>

    <footer>
      <span><van-icon name="arrow-left"/></span
      ><span><van-icon name="arrow"/></span>
    </footer>
  </div>
</template>

<script>
import Headerss from "../../components/Headerss";

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    Headerss,
  },
  data() {
    //这里存放数据
    return {
      showPopover: false, //控制弹框
    };
  },
  //监听属性 类似于data概念

  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    //跳转到支付页面
    topays() {
      this.$router.push("/payment");
    },
    gohome() {
      this.$router.push("/layout/my");
    },
    //弹框
    isShow() {
      this.showPopover = !this.showPopover;
      console.log(this.showPopover);
    },
    //跳转消费记录
    // toConsumption() {
    //   this.$router.push("/consumption");
    // },
    //跳转银行卡记录
    toBankCard() {
      this.$router.push("/bankCard");
    },
    //跳转到充值未绑卡页面
    toRecharge() {
      this.$router.push("/recharge");
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
};
</script>
<style lang="scss" scoped>
@import "@css/style.scss";
.balance {
  width: 100%;
  height: 100%;
  background: #fff;
  overflow-y: scroll;
  overflow: hidden;
}
header {
  width: 100%;
  height: 50px;
  font-size: 20px;
  display: flex;
  justify-content: space-between;
  line-height: 50px;
  padding: 0 10px;
  background: #ccc;
}
main {
  flex: 1;
  width: 100%;
  height: 87%;
  background: #fff;
  flex: 1;
  overflow-y: scroll;
  .top {
    width: px2rem(355);
    height: px2rem(171);
    background: #f44e40;
    margin: auto;
    margin-left: px2rem(8);
    margin-top: px2rem(10);
    border-radius: px2rem(10);
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    :nth-child(1) {
      width: 50%;
      padding-left: px2rem(16);
      .yuan {
        color: #f4ac8e;
        font-size: px2rem(12);
      }
      .price {
        color: #fff;
        padding-left: px2rem(10);
      }
    }
    :nth-child(2) {
      width: 50%;
      .recharge {
        color: #bd6f62;
        margin-left: px2rem(70);
        padding-left: px2rem(22);
        font-size: px2rem(16);
        background: #fffcf7;
        border-radius: px2rem(20);
        width: px2rem(78);
        height: px2rem(28);
        line-height: px2rem(28);
      }
    }
    :nth-child(3) {
      width: 50%;
      padding-left: px2rem(8);
      .yuan {
        color: #f4ac8e;
        font-size: px2rem(6);
      }
      .price {
        color: #fff;
        padding-left: px2rem(14);
        font-size: px2rem(32);
      }
    }
    :nth-child(4) {
      width: 50%;
      padding-left: px2rem(8);
      .yuan {
        font-size: px2rem(6);
        color: #f4ac8e;
      }
      .price {
        color: #fff;
        padding-left: px2rem(14);
        font-size: px2rem(32);
      }
    }
  }
  .middle {
    display: flex;
    margin: 0 auto;
    border-bottom: 1px solid #eee;
    justify-content: space-around;
    padding: px2rem(10) 0;
    background: #fff;
    li {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: px2rem(5) 0;
      justify-content: space-around;
      margin: px2rem(15) 0 0 0;
      span {
        flex: 1;
        font-size: px2rem(12);
        margin-top: px2rem(8);
        color: #26363c;
      }
    }
  }
  .lower {
    height: px2rem(120);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: #fff;
    border-bottom: 12px solid #f6f6f6;
    img {
      width: px2rem(170);
      height: px2rem(66);
    }
  }
}
footer {
  width: 100%;
  height: px2rem(50);
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: space-around;
  :nth-child(2) {
    color: #ccc;
  }
}
.zuixia p {
  width: 100%;
  height: px2rem(50);
  background: #fff;
  font-size: px2rem(16);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.zuihou {
  width: 100%;
  height: px2rem(100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: px2rem(20);
  margin-left: px2rem(20);
  flex-wrap: wrap;
  .imgs {
    width: 45%;
    img {
      width: 80%;
      height: 80%;
    }
  }
  .imgss {
    width: 45%;
    img {
      width: 80%;
      height: 80%;
    }
  }
}
.dialog {
  width: px2rem(130);
  height: px2rem(65);
  font-size: px2rem(12);
  border: 1px solid #ccc;
  background: #fff;
  position: fixed;
  top: px2rem(70);
  right: px2rem(-40);
  padding: 8px;
  :nth-child(1) {
    margin-bottom: 3px;
  }
}
</style>
